home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
STANDALO
/
SQUARANT
/
SQUARANT.H
< prev
Wrap
Text File
|
1990-11-15
|
5KB
|
156 lines
/***********************************************************************************
SIMPLE SYSTEMS¬ CLASS LIBRARY
SQuarantine.h
This is a class for virus protection. This object scans each
resource in the given resource file and compares the resource
profile against a static table. All differences are reported
according to the search criteria.
This source code is released for limited use, any commerical
product that uses this source code should acknowledge the author,
Schorschi LeRoy Decker, in the manual documentation and/or in the
'About...' window for his creative effort.
Version 1.0.0 11/10/90
Schorschi LeRoy Decker
Made some documentation changes.
Version 1.0.1 11/15/90
Schorschi LeRoy Decker
***********************************************************************************
IN NO WAY, SHAPE, OR FORM IS THIS FILE RELEASED TO BUSINESS ENTITIES THAT
CHARGE A FEE FOR DISTRIBUTION. FIRMS LIKE EDUCORP¬, WHICH CHARGE DISTRIBUTION
FEES FOR PUBLIC DOMAIN OR SHAREWARE PRODUCTS, MUST RECEIVE WRITTEN PERMISSION
FROM SIMPLE SYSTEMS¬ AND THE ORIGINAL AUTHOR OF THIS SOURCE CODE. BULLETIN BOARD
SYSTEMS AND ON-LINE SERVICES THAT CHARGE A CONNECT FEE ARE GIVEN LIMITED
PERMISSION FOR DOWNLOAD ACCESS BY MEMBERS. ANY VIOLATION OF THIS RESERVED RIGHT
OF LIMITED DISTRIBUTION WILL BE INFORCED TO THE FULLEST EXTENT OF THE LAW.
COPYRIGHT ⌐ 1990 SIMPLE SYSTEMS¬. ALL RIGHTS ARE RESERVED WORLD-WIDE.
SIMPLE SYSTEMS¬ is the trademark and property of SIMPLE SYSTEMS CONSULTING.
EDUCORP¬ is the trademark and property of EDUCORP Inc.
***********************************************************************************
SQuarantine 'Qnte' custom resource format notes...
Each valid resource in a given resource file should have a record
in the appropiate quarantine table, resource type 'Qnte', which
includes the resource type, id, size, and name. The format is
given below:
Flags Type ID Size Name
--------------------------------------------------------------
0 BNDL 128 36 "\pThis sample 'Qnte' record."
0 FREF 128 54 "\pThis another sample."
***** one record for each expected, and valid, resource. *****
0 .... 0 -1 "\p"
--------------------------------------------------------------
Note the size field of the last record. The End-of-File, or in this
case, the End-of-Table marker is a size field initialized to -1. If
the last record does not have a size field set to -1 then the scan
methods of the SQuarantine object will run in an endless loop until
la bomba.
The included template for ResEdit, "'Qnte' Resource Template." The
template does NOT generate an End-of-Table record. The End-of-Table
record must be manually entered like all other records.
Notes about applications that modify resources...
An application should never modify or change its own resources, but...
Any application that modifies a resource type, id, size or name so that
the corresponding resource record in the 'Qnte' resource does not match
will cause SQuarantine to generate a false virus or anomaly result.
Besides, an application that modify its own resources in the realm of
bad karma!
A solution to this problem is to establish a given size for the changable
resource and pack null bytes as necessary to maintain the established size.
Of course, the changing of a type, id number, or name of a resource by an
application is really bad karma!!
***********************************************************************************
Questions, comments, etc.
To: SIMPLE SYSTEMS
Schorschi LeRoy Decker
5067 Golden Ave.
Riverside, CA 92505
America-On-Line: Schorschi
CompuServe: 73020,546
Phone: (714) 597-1234 Please not after 11:00 pm (Pacific) or before
7:00 am (Pacific).
***********************************************************************************/
#include <CObject.h>
/***********************************************************************************/
#define kTypeAndID 8
#define kName 4
#define kSize 2
#define kQuarantineShift 12
#define rQuarantineType 'Qnte'
#define rQuarantineNumber 128
/***********************************************************************************
The following structure declaration is used to define the a resource verification
table record, which is actually a segment of the 'Qnte' resource handle.
***********************************************************************************/
typedef struct QuarantineRec
{
int flags;
long type;
int id;
long size;
Str255 name;
} QuarantineRec, *QuarantinePtr, **QuarantineHdl;
/***********************************************************************************/
struct SQuarantine : CObject
{
/* Instance Variables. */
StringHandle theQuarantineMap;
int theQuarantineFile;
/* Instance Methods. */
void IQuarantine(int);
void Dispose(void);
Boolean Scan(int);
Boolean TypeAndID(Handle);
Boolean Size(Handle);
Boolean Name(Handle);
Boolean Missed(void);
};
/***********************************************************************************
End of File - SQuarantine.h
***********************************************************************************/